
<%@page import="entities.Product, java.util.List, com.util.HbnUtil, org.hibernate.Session, org.hibernate.Transaction" %>
<%
Session se = HbnUtil.getSession();
Transaction tran = se.beginTransaction();
List<Product> list = se.createQuery("from Product").list();

int row = 0;
for(Product p : list)
{
if(row%2==0){
 out.println("<div class=\"ui two column relaxed grid\">");	
	out.println("<div class=\"row\">");
}
 out.println("<div class=\"column\"><div class=\"ui fluid form segment\">");
 out.println("<div class=\"ui top right attached label\">$"+p.getPrice()+"</div>");
 out.println("<div class=\"field\">");
 out.println(p.getName());
 out.println("</div>");
/*  out.println("<div class=\"field\">");
 out.println(p.getPrice());
 out.println("</div>"); */
 out.println("<div class=\"field\">");
 out.println(" <img class=\"rounded ui image\" src=\""+ p.getImgpath() +"\">");
 out.println("</div>");
 out.println("<div class=\"field\">");
 out.println("<div class=\"ui segment\">");
 out.println("<p>"+p.getDescription()+"</p>");
 out.println("</div>");
 out.println("</div>");
 out.println("<div class=\"ui top left attached label\">");
 out.println("<a class=\"ui purple label\">" + p.getDiscount()*100 +"% off");
 out.println("</a>");
 out.println("</div>");
 out.println("<div class=\"ui bottom right attached label \">" );

out.println("<form action = \"AddToCart\" method =\"post\">");
out.println("<input name=\"Productid\" type=\"hidden\" value=\""+p.getProductid()+"\"/>");
out.println("<button class=\"ui red button\" " + "type = \"submit\" value = \"submit\"" +">"+ "Add to Cart" + "</button>");
out.println("</form>");
 /*  out.println("<a class=\"ui purple label\" id=\"" + p.getProductid() + "\" onclick=\"ajaxGET(this,'/AddToCart')" +"\">" + "Add to Cart");
 out.println("</a>"); */
 
 out.println("</div>");
 out.println("</div>");
 out.println("</div>");
 //out.println("<div class=\"ui vertical divider\"><i class=\"circular heart icon\"></i></div>");
 row ++;
 if(row%2==0)
 {
	 out.println("</div></div>");
	 //out.println("<br/><div class=\"ui divider\"></div>");
 }
}
%>